﻿#include "Point.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "GUIFrame/MainWindow.h"

#include "FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoModelPoint.h"

Point::Point(int id)
{

}

Point::Point(Interface::FITKAbsGeoModelPoint* p)
{

}

int Point::getPointID()
{
    //Point ID
    return -1;
}

QString Point::getName() const
{
    //获取名称
    if (_point == nullptr) return QString();
    return _point->getDataObjectName();
}

void Point::reName(const QString &name)
{
    //重命名
    if (_point == nullptr) return;
    _point->setDataObjectName(name);
}

Point* Point::getPoint(const QString & pName)
{
    if (_point == nullptr) return nullptr;
    return new Point();
}

Point* PointWapper::new_Point()
{
    return new Point(0);
}

void PointWapper::delete_Point(Point* c)
{
    delete c;
}

void PointWapper::static_Point_SetCurrentPoint(QString & PointName)
{
}

Point* PointWapper::static_Point_GetCurrentPoint()
{
    return new Point();
}

void PointWapper::static_Point_CreatePoint(const QString& PointName)
{
}

Point* PointWapper::static_Point_GetPoint(const QString& PointName)
{
    return new Point();
}

void PointWapper::reName(Point* c, QString& name)
{
    if (c == nullptr) return;
    c->reName(name);
    updateUI(c->getPointID());
}

QString PointWapper::getName(Point* C)
{
    if (C == nullptr) return QString();
    return C->getName();
}

Point* PointWapper::getPoint(Point* c, const QString& name)
{
    if (c) return c->getPoint(name);
    return nullptr;
}

void PointWapper::updateUI(int Pointid)
{
    ////更新树
    //auto treeOper = Core::FITKOperatorRepo::getInstance()->getOperatorT<EventOper::TreeEventOperator>("ModelTreeEvent");
    //if (treeOper) treeOper->updateTree(Pointid, GUI::GTTModelRoot);
    ////更新菜单
    //auto mw = FITKAPP->getGlobalData()->getMainWindowT<GUI::MainWindow>();
    //if (!mw) return;
    //GUI::MenuManager* menuManager = mw->getMenuManager();
    //if (menuManager != nullptr)
    //    menuManager->updateMenuBar(GUI::GUIModuleType::GMTALL);
    ////更新视图
    //GUI::CentralView* centralView = mw->getCentralView();
    //if (centralView == nullptr) return  ;
    //GUI::NavigationBar* navigationBar = centralView->getNavigationBar();
    //if (navigationBar == nullptr) return  ;
    //navigationBar->updateModel(false);
}



